Imports System.Web.UI.WebControls
Imports System.Text
Imports System.Web.UI

Namespace DotNetNuke.Modules.ActiveForums
    Partial Public Class admin_manageforums
        Inherits ActiveAdminBase
        Public imgOn As String = String.Empty
        Public imgOff As String = String.Empty
        Public ctlView As String = String.Empty
#Region "Event Handlers"
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            imgOn = Page.ResolveUrl("~/DesktopModules/ActiveForums/images/admin_check.png")
            imgOff = Page.ResolveUrl("~/DesktopModules/ActiveForums/images/admin_stop.png")

            litButtons.Text = "<div class=""amcplnkbtn"" onclick=""LoadView('manageforums_forumeditor','0|G');"">[RESX:NewForumGroup]</div><div class=""amcplnkbtn"" onclick=""LoadView('manageforums_forumeditor','0|F');"">[RESX:NewForum]</div>"

            
            GetControl("admin_manageforums_home", String.Empty)
            

        End Sub
        Private Sub cbForumEditor_Callback(ByVal sender As Object, ByVal e As Modules.ActiveForums.Controls.CallBackEventArgs) Handles cbForumEditor.Callback
            Try
                Dim sOptions As String = String.Empty
                If Not e.Parameters(1) Is Nothing Then
                    sOptions = e.Parameters(1)
                End If
                GetControl(e.Parameters(0), sOptions)
                Dim stringWriter As System.IO.StringWriter = New System.IO.StringWriter
                Dim htmlWriter As HtmlTextWriter = New HtmlTextWriter(stringWriter)
                plhForumEditor.RenderControl(e.Output)
            Catch ex As Exception

            End Try
        End Sub
#End Region

#Region "Private Methods"
        Private Sub GetControl(ByVal view As String, ByVal options As String)
            Try
                plhForumEditor.Controls.Clear()
                Dim ctlPath As String = String.Empty
                Dim ctlId As String = String.Empty
                If view = "admin_manageforums_home" Then
                    ctlPath = "~/DesktopModules/ActiveForums/controls/admin_manageforums_home.ascx"
                    ctlId = "admin_manageforums_home"
                Else
                    ctlPath = "~/DesktopModules/ActiveForums/controls/admin_manageforums_forumeditor.ascx"
                    ctlId = "admin_manageforums_forumeditor"
                End If

                Dim ctl As ActiveAdminBase = CType(LoadControl(ctlPath), ActiveAdminBase)
                ctl.ID = ctlId
                ctl.ModuleConfiguration = Me.ModuleConfiguration

                If Not options = String.Empty Then
                    ctl.Params = options
                End If
                If Not plhForumEditor.Controls.Contains(ctl) Then
                    plhForumEditor.Controls.Add(ctl)
                End If
            Catch ex As Exception
                Dim lit As New LiteralControl
                lit.Text = ex.Message
                plhForumEditor.Controls.Add(lit)
            End Try


        End Sub

#End Region




    End Class
End Namespace
